package com.example.web.sys_user.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author LS
 * @since 2024-02-20
 */
@Getter
@Setter
@TableName("sys_user")
@ApiModel(value = "User对象")
public class User implements UserDetails {

    @ApiModelProperty("用户id")
    @TableId(value = "user_id", type = IdType.AUTO)
    private Long userId;

    @ApiModelProperty("登录账户")
    private String username;

    @ApiModelProperty("登录密码")
    private String password;

    @ApiModelProperty("电话")
    private String phone;

    @ApiModelProperty("邮箱")
    private String email;

    @ApiModelProperty("性别")
    private String sex;

    @ApiModelProperty("是否是超级管理员 1：是 0：否")
    private String isAdmin;

    @ApiModelProperty("账户是否过期 1 未过期，0已过期")
    private boolean isAccountNonExpired = true;

    @ApiModelProperty("帐户是否被锁定(1 未锁定，0已锁定)")
    private boolean isAccountNonLocked = true;

    @ApiModelProperty("密码是否过期(1 未过期，0已过期)")
    private boolean isCredentialsNonExpired = true;

    @ApiModelProperty("帐户是否可用(1 可用，0 删除用户)")
    private boolean isEnabled = true;

    @ApiModelProperty("姓名")
    private String nickName;

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("更新时间")
    private Date updateTime;

    //不属于用户表，需要排除
    @TableField(exist = false)
    private String roleId;

    @TableField(exist = false)
    Collection<? extends GrantedAuthority> authorities;

}
